<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>    
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>INDEX</title>
    
</head>

<body>
	<div>
					<c:if test="${sessionScope.user.issuper == 1 }">
					<a href="javascript:void(0)" id="add1" class="easyui-linkbutton">添加</a>
					</c:if>
						<input type="hidden" id="aid" value="${cate.aid }" />
						<input type="hidden" id="pid" value="${cate.pid }" />
						<input type="hidden" id="apisid" value="${apis.id }" />
						<input type="hidden" id="jspname" />
					<a href="javascript:void(0)" id="go1" class="easyui-linkbutton">返回</a>
					<input class="easyui-searchbox" style="width:150px" id="ss" value="${des }" />
				</div>
	<div>
		<table>
			<c:forEach var="pl" items="${projlist }">
				<tr>
					<td>
						<a href="<%=path%>/projAction!gotolist" class="plcname">${pl.cname }</a>
						<br />
						${pl.cdesc }
						<table>
						<c:forEach var="cl" items="${catelist }">
							<c:if test="${pl.aid == cl.pid}">
								<tr><td>
									&nbsp;&nbsp;<a href="<%=path%>/cateAction!cate?cate.pid=${cl.pid }">${cl.cname }</a>
									<br />&nbsp;&nbsp;${cl.cdesc }
									<table>
										<c:forEach var="al" items="${apilist }">
											<c:if test="${al.aid == cl.aid}">
												<tr><td style="color:#2980B9;">
													&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=path%>/apiAction!gotoapieditandinfo?api.id=${al.id }&cate.aid=${cate.aid}&cate.pid=${cate.pid}">${al.cname }</a>
													<br />
													&nbsp;&nbsp;&nbsp;&nbsp;${al.cdesc }
												</td></tr>
												<tr><td>
													&nbsp;
												</td></tr>
											</c:if>
										</c:forEach>
									</table>
								</td></tr>
							</c:if>
						</c:forEach>
						</table>
					</td>
				</tr>
			</c:forEach>
		</table>
	</div>

<script type="text/javascript">
$(document).ready(function(){

	$("#add1").click(function(){
		window.location.href="<%=path%>/apiAction!gotoapiadd?cate.aid="+$("#aid").val()+"&cate.pid="+$("#pid").val();
	});
	
	$("#go1").click(function(){
		window.location.href="<%=path%>/cateAction!cate?cate.pid="+$("#pid").val();
	});
	
	$('#ss').searchbox({ 
		width:200, 
		prompt:'请输入接口名称或描述',
		searcher:function(){ 
			var name = $("#jspname").val();
			var des = $("#ss").val();
			var met = "";
			if("apiedit" == name){
				met = "gotoapiedit";
			}
			if("apiadd" == name){
				met = "gotoapiadd";
			}
			var url = "<%=path%>/apiAction!"+met+"?cate.aid="+$("#aid").val()+"&cate.pid="+$("#pid").val()+"&api.cname="+des;
			if("apieditandinfo" == name){
				met = "gotoapieditandinfo";
				url = "<%=path%>/apiAction!"+met+"?cate.aid="+$("#aid").val()+"&cate.pid="+$("#pid").val()+"&api.cname="+des;
				url += "&api.id="+$("#apiid").val();
			}
			if("test" == name){
				met = "gototest";
				url = "<%=path%>/apiAction!"+met+"?cate.aid="+$("#aid").val()+"&cate.pid="+$("#pid").val()+"&api.cname="+des;
				url += "&api.id="+$("#apiid").val();
			}
			window.location.href=url;
		}
	});
	
});	
	
</script>	
</body>
</html>